/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2018-05-14 00:14:28
 * @Description: 缓存代理 
 */
var mult = function() {
  var a = 1;
  for(var i = 0, len = arguments.length;i < len;i++) {
    a = a * arguments[i]
  }
  console.log('---')
  return a;
}

var proxyMult = (function() {
  var cache = {};
  return function() {
    var args = Array.prototype.join.call(arguments, ',');
    if(args in cache) {
      return cache[args]
    }
    return cache[args] = mult.apply(this, arguments);
  }
})()

proxyMult(1,2,3,4);
proxyMult(1,2,3,4);
